package gsw.demo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import java.io.File;

import gsw.tool.glide.Glide;
import gsw.tool.glide.R;
import gsw.tool.glide.request.RequestOptions;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ImageView iv = findViewById(R.id.iv);
        ImageView iv1 = findViewById(R.id.iv1);
        ImageView iv2 = findViewById(R.id.iv2);

        String file = "/sdcard/main.jpg";
        String url = "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2669567003,3609261574&fm=27&gp=0.jpg";
        RequestOptions options = new RequestOptions().error(R.mipmap.icon).placeholder(R.mipmap.icon).override(300, 300);
        Glide.with(this).load(url).apply(options).into(iv);
        Glide.with(this).load(file).apply(options).into(iv1);
        Glide.with(this).load(new File(file)).apply(options).into(iv2);
    }

    public void toNext(View view) {
        startActivity(new Intent(this, SecondActivity.class));
    }
}
